﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sys_organ_edit.aspx.cs" Inherits="Ccit.SysPlat.Organ.sys_organ_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="../css/main.css" type="text/css" />
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/jsonlib.js"></script>
    <script type="text/javascript">
    <!--
        function checkForm() {
            var ctrlOrganName = $get("txtOrganName");
            if(jQuery.trim(ctrlOrganName.value) == "") {
                ctrlOrganName.focus();
                alert("请输入机构名称!");
                return false;
            }
            
            return true;
        }
    
        function doSave(ctrlType) {
            if(!checkForm()) return;
            
            var organObj = {};
            organObj.organId = $get("_hidOrganId").value;
            organObj.organName = jQuery.trim($get("txtOrganName").value);
            organObj.organCode = jQuery.trim($get("txtOrganCode").value);
            organObj.organDesc = $get("txtDesc").value;

            var jsonExpr = JSON.stringify(organObj, function(key, value) { return value; });
            PageMethods.SaveOrgan(jsonExpr, ctrlType, ClientCallBack);
        }

        function ClientCallBack(vResult) {
            if (null == vResult || vResult == "undefined") {
                alert("网络传输错误,没有正确的返回值,请检查网络是否畅通!");
                return;
            }
            eval("var resultObj=" + vResult);
            var operType = resultObj.OPERTYPE;
            switch (operType) {
                case "SAVE":
                    alert(resultObj.RSTMSG);
                    if (parseInt(resultObj.RSTSIGN) > 0) {                        
                        var ctrlType = resultObj.CTRLTYPE;
                        switch (ctrlType) {
                            case "1": // save only
                                break;
                        }
                    }
                    break;
            }
            resultObj = null;
        }
    //-->
    </script>
</head>
<body>
    <form id="form1" runat="server">    
    <input type="hidden" id="_hidOrganId" runat="server" />
    <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
    </asp:ScriptManager>
        <table class="tbToolbar" cellpadding="0" cellspacing="0" width="98%" align="center">
            <tr>
                <td align="left">
                    <div class="tbSeparator"></div>
                </td>
                <td width="100%" class="titlebar">
                    机构信息维护
                </td>
                <td align="right">
                    <div class="tbSeparatorEnd"></div>
                </td>
            </tr>
        </table>
        <table class="tableborder" cellpadding="0" cellspacing="0" width="98%" align="center">
            <tr>
                <td width="10%" align="right" class="pformleft"><nobr><font color='red'>*</font>机构名称</nobr></td>
                <td align="left" class="pformright">
                    <asp:TextBox ID="txtOrganName" CssClass="input" Width="98%" runat="server"></asp:TextBox>                    
                </td>
            </tr>
            <tr>
                <td width="10%" align="right" class="pformleft"><nobr>机构代码</nobr></td>
                <td align="left" class="pformright">
                    <asp:TextBox ID="txtOrganCode" CssClass="input" Width="98%" runat="server"></asp:TextBox>                                  
                </td>
            </tr>
            <tr>
                <td width="10%" align="right" class="pformleft" valign="top"><nobr>机构描述</nobr></td>
                <td align="left" class="pformright">
                    <asp:TextBox ID="txtDesc" CssClass="textinput" TextMode="MultiLine" Width="98%" Rows="5" runat="server"></asp:TextBox>                    
                </td>
            </tr>
            <tr class="pformstrip">
                <td colspan="2" align="center">
                    <input type="button" id="btnSave" value="保存" class="button" onclick="doSave('1')" >
                </td>
            </tr>
        </table>
    </form>
    <script type="text/javascript">
    <!--
        $(document).ready(function() {
                    
        });
    //-->
    </script>
</body>
</html>
